import 'package:flutter/src/widgets/navigator.dart';
import 'package:whale/helper/global/user/logic.dart';
import 'package:whale/helper/utils/util.dart';

class TPMiddlewares extends GetMiddleware {
  @override
  RouteSettings? redirect(String? route) {
    if (route == RouterPath.means_detail ||
        route == RouterPath.qrcodeView ||
        route == RouterPath.search) {
      if (!UserController().isLogin) {
        return const RouteSettings(name: RouterPath.login);
      }
    }
    return super.redirect(route);
  }
}
